package com.stellar.auth.basic.service.impl;

import com.stellar.auth.basic.dao.AuthPermissionDao;
import com.stellar.auth.basic.entity.AuthPermission;
import com.stellar.auth.basic.service.AuthPermissionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
 * 权限表(AuthPermission)服务实现
 *
 * @author Jqchan
 * @since 2025-05-16 18:07:20
 */
@Service
public class AuthPermissionServiceImpl implements AuthPermissionService {

    @Resource
    private AuthPermissionDao authPermissionDao;

    @Override
    public AuthPermission queryById(Long id) {
        return authPermissionDao.queryById(id);
    }

    @Override
    public AuthPermission queryByCondition(AuthPermission condition) {
        return authPermissionDao.queryByCondition(condition);
    }

    @Override
    public List<AuthPermission> queryAllByCondition(AuthPermission condition) {
        return authPermissionDao.queryAllByCondition(condition);
    }

    @Override
    public List<AuthPermission> page(AuthPermission condition, int page, int pageSize) {
        return authPermissionDao.page(condition, page, pageSize);
    }

    @Override
    public int insert(AuthPermission entity) {
        return authPermissionDao.insert(entity);
    }

    @Override
    public int update(AuthPermission entity) {
        return authPermissionDao.update(entity);
    }

    @Override
    public int deleteById(Long id) {
        return authPermissionDao.deleteById(id);
    }

    @Override
    public Long count(AuthPermission condition) {
        return authPermissionDao.count(condition);
    }

    @Override
    public List<AuthPermission> batchQueryByIds(List<Long> permissionIds) {
        return authPermissionDao.batchQueryByIds(permissionIds);
    }

    @Override
    public List<AuthPermission> selectAllPermissions() {
        return authPermissionDao.selectAllPermissions();
    }

    @Override
    public List<Long> findIdsByParentId(Long id) {
        return authPermissionDao.findIdsByParentId(id);
    }

    @Override
    public int batchMarkAsDeleted(List<Long> childIds) {
        return authPermissionDao.batchMarkAsDeleted(childIds);
    }

    @Override
    public List<Long> findIdsByParentIdAndType(Long id, Integer code) {
        return authPermissionDao.findIdsByParentIdAndType(id, code);
    }

    @Override
    public List<Long> findAllDescendantIds(Long id) {
        return authPermissionDao.findAllDescendantIds(id);
    }
}
